<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.zlib</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.zlib";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.zlib.html" class="symbol">std.zlib</a></h1>
  
<div class="summary">Compress/decompress data using the <a href="http://www._zlib.net">zlib library</a>.</div>
<p class="sec_header">References:</p><a href="http://en.wikipedia.org/wiki/Zlib">Wikipedia</a>
<p class="sec_header">License:</p>Public Domain
<dl>
<dt class="decl"><a class="symbol _enum" name="enum" href="./htmlsrc/std.zlib.html#L24" kind="enum" beg="24" end="30">enum</a>; <a title="Permalink to this symbol" href="#enum" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L24">#</a></dt>
<dd class="ddef">
<dl>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_NO_FLUSH" href="./htmlsrc/std.zlib.html#L26" kind="enummem" beg="26" end="26">Z_NO_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_NO_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L26">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_SYNC_FLUSH" href="./htmlsrc/std.zlib.html#L27" kind="enummem" beg="27" end="27">Z_SYNC_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_SYNC_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L27">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_FULL_FLUSH" href="./htmlsrc/std.zlib.html#L28" kind="enummem" beg="28" end="28">Z_FULL_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_FULL_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L28">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_FINISH" href="./htmlsrc/std.zlib.html#L29" kind="enummem" beg="29" end="29">Z_FINISH</a> <a title="Permalink to this symbol" href="#enum.Z_FINISH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L29">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">class <a class="symbol _class" name="ZlibException" href="./htmlsrc/std.zlib.html#L36" kind="class" beg="36" end="55">ZlibException</a> : Exception; <a title="Permalink to this symbol" href="#ZlibException" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L36">#</a></dt>
<dd class="ddef">
<div class="summary">Errors throw a ZlibException.</div>
<dl>
<dt class="decl"><a class="symbol _ctor" name="ZlibException.this" href="./htmlsrc/std.zlib.html#L38" kind="ctor" beg="38" end="54">this</a><span class="params">(int <em>errnum</em>)</span>; <a title="Permalink to this symbol" href="#ZlibException.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L38">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">uint <a class="symbol _function" name="adler32" href="./htmlsrc/std.zlib.html#L62" kind="function" beg="62" end="65">adler32</a><span class="params">(uint <em>adler</em>, const( void)[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#adler32" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L62">#</a></dt>
<dd class="ddef">
<div class="summary">Compute the Adler32 checksum of the data in buf[]. adler is the starting
 value when computing a cumulative checksum.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.zlib.html#L67" kind="unittest" beg="67" end="77">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L67">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">uint <a class="symbol _function" name="crc32" href="./htmlsrc/std.zlib.html#L84" kind="function" beg="84" end="87">crc32</a><span class="params">(uint <em>crc</em>, const( void)[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#crc32" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L84">#</a></dt>
<dd class="ddef">
<div class="summary">Compute the CRC32 checksum of the data in buf[]. crc is the starting value
 when computing a cumulative checksum.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:2" href="./htmlsrc/std.zlib.html#L89" kind="unittest" beg="89" end="99">unittest</a>; <a title="Permalink to this symbol" href="#unittest:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L89">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void</dt>[] <a class="symbol _function" name="compress" href="./htmlsrc/std.zlib.html#L109" kind="function" beg="109" end="130">compress</a><span class="params">(const( void)[] <em>srcbuf</em>, int <em>level</em>)</span>; <a title="Permalink to this symbol" href="#compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L109">#</a></dl>
<dt class="decl">void</dt>[] <a class="symbol _function" name="compress:2" href="./htmlsrc/std.zlib.html#L136" kind="function" beg="136" end="139">compress</a><span class="params">(const( void)[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#compress:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L136">#</a>)
<dd class="ddef">
<div class="summary">Compresses the data in srcbuf[] using compression _level level.
 The default value
 for level is 6, legal values are 1..9, with 1 being the least compression
 and 9 being the most.
 Returns the compressed data.</div></dd>
<dt class="decl">void</dt>[] <a class="symbol _function" name="uncompress" href="./htmlsrc/std.zlib.html#L149" kind="function" beg="149" end="196">uncompress</a><span class="params">(const( void)[] <em>srcbuf</em>, uint <em>destlen</em> = 0u, int <em>winbits</em> = 15)</span>; <a title="Permalink to this symbol" href="#uncompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L149">#</a>)
<dd class="ddef">
<div class="summary">Decompresses the data in srcbuf[].</div>
<p class="sec_header">Params:</p>
<table class="params">
<tr><td><em>destlen</em></td><td>size of the uncompressed data.
 It need not be accurate, but the decompression will be faster if the exact
 size is supplied.</td></tr></table>
<p class="sec_header">Returns:</p>the decompressed data.</dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:3" href="./htmlsrc/std.zlib.html#L198" kind="unittest" beg="198" end="213">unittest</a>; <a title="Permalink to this symbol" href="#unittest:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L198">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">class <a class="symbol _class" name="Compress" href="./htmlsrc/std.zlib.html#L233" kind="class" beg="233" end="388">Compress</a>; <a title="Permalink to this symbol" href="#Compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L233">#</a></dt>
<dd class="ddef">
<div class="summary">Used when the data to be compressed is not all in one buffer.</div>
<dl>
<dt class="decl">z_stream <a class="symbol _variable" name="Compress.zs" href="./htmlsrc/std.zlib.html#L236" kind="variable" beg="236" end="236">zs</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.zs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L236">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="Compress.level" href="./htmlsrc/std.zlib.html#L237" kind="variable" beg="237" end="237">level</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.level" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L237">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="Compress.inited" href="./htmlsrc/std.zlib.html#L238" kind="variable" beg="238" end="238">inited</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.inited" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L238">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="Compress.error" href="./htmlsrc/std.zlib.html#L240" kind="function" beg="240" end="247">error</a><span class="params">(int <em>err</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.error" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L240">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _ctor" name="Compress.this" href="./htmlsrc/std.zlib.html#L254" kind="ctor" beg="254" end="262">this</a><span class="params">(int <em>level</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L254">#</a></dt>
<dt class="decl"><a class="symbol _ctor" name="Compress.this:2" href="./htmlsrc/std.zlib.html#L265" kind="ctor" beg="265" end="267">this</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L265">#</a></dt>
<dd class="ddef">
<div class="summary">Construct. level is the same as for D.zlib.compress().</div></dd>
<dt class="decl"><a class="symbol _dtor" name="Compress.~this" href="./htmlsrc/std.zlib.html#L269" kind="dtor" beg="269" end="279">~this</a>(); <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.~this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L269">#</a></dt>

<dt class="decl">void</dt>[] <a class="symbol _function" name="Compress.compress" href="./htmlsrc/std.zlib.html#L286" kind="function" beg="286" end="318">compress</a><span class="params">(const( void)[] <em>buf</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L286">#</a></dl>
<dd class="ddef">
<div class="summary">Compress the data in buf and return the compressed data.
 The buffers
 returned from successive calls to this should be concatenated together.</div></dd>
<dt class="decl">void[] <a class="symbol _function" name="Compress.flush" href="./htmlsrc/std.zlib.html#L338" kind="function" beg="338" end="387">flush</a><span class="params">(int <em>mode</em> = Z_FINISH)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.flush" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L338">#</a></dt>
<dd class="ddef">
<div class="summary">Compress and return any remaining data.
 The returned data should be appended to that returned by compress().</div>
<p class="sec_header">Params:</p>
<table class="params">
<tr><td><em>mode</em></td><td>one of the following: 
                <dl>
                    <dt>Z_SYNC_FLUSH </dt>
                    <dd>Syncs up flushing to the next byte boundary.
                        Used when more data is to be compressed later on.</dd>
                    <dt>Z_FULL_FLUSH </dt>
                    <dd>Syncs up flushing to the next byte boundary.
                        Used when more data is to be compressed later on,
                        and the decompressor needs to be restartable at this
                        point.</dd>
                    <dt>Z_FINISH</dt>
                    <dd>(default) Used when finished compressing the data. </dd>
                </dl></td></tr></table></dd></dd>)
<dt class="decl">class <a class="symbol _class" name="UnCompress" href="./htmlsrc/std.zlib.html#L394" kind="class" beg="394" end="536">UnCompress</a>; <a title="Permalink to this symbol" href="#UnCompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L394">#</a></dt>
<dd class="ddef">
<div class="summary">Used when the data to be decompressed is not all in one buffer.</div>
<dl>
<dt class="decl">z_stream <a class="symbol _variable" name="UnCompress.zs" href="./htmlsrc/std.zlib.html#L397" kind="variable" beg="397" end="397">zs</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.zs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L397">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="UnCompress.inited" href="./htmlsrc/std.zlib.html#L398" kind="variable" beg="398" end="398">inited</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.inited" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L398">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="UnCompress.done" href="./htmlsrc/std.zlib.html#L399" kind="variable" beg="399" end="399">done</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.done" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L399">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">uint <a class="symbol _variable" name="UnCompress.destbufsize" href="./htmlsrc/std.zlib.html#L400" kind="variable" beg="400" end="400">destbufsize</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.destbufsize" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L400">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="UnCompress.error" href="./htmlsrc/std.zlib.html#L402" kind="function" beg="402" end="409">error</a><span class="params">(int <em>err</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.error" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L402">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _ctor" name="UnCompress.this" href="./htmlsrc/std.zlib.html#L416" kind="ctor" beg="416" end="419">this</a><span class="params">(uint <em>destbufsize</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L416">#</a></dt>
<dt class="decl"><a class="symbol _ctor" name="UnCompress.this:2" href="./htmlsrc/std.zlib.html#L422" kind="ctor" beg="422" end="424">this</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L422">#</a></dt>
<dd class="ddef">
<div class="summary">Construct. destbufsize is the same as for D.zlib.uncompress().</div></dd>
<dt class="decl"><a class="symbol _dtor" name="UnCompress.~this" href="./htmlsrc/std.zlib.html#L426" kind="dtor" beg="426" end="437">~this</a>(); <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.~this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L426">#</a></dt>

<dt class="decl">void</dt>[] <a class="symbol _function" name="UnCompress.uncompress" href="./htmlsrc/std.zlib.html#L444" kind="function" beg="444" end="483">uncompress</a><span class="params">(const( void)[] <em>buf</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.uncompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L444">#</a></dl>
<dd class="ddef">
<div class="summary">Decompress the data in buf and return the decompressed data.
 The buffers returned from successive calls to this should be concatenated
 together.</div></dd>
<dt class="decl">void[] <a class="symbol _function" name="UnCompress.flush" href="./htmlsrc/std.zlib.html#L490" kind="function" beg="490" end="535">flush</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.flush" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L490">#</a></dt>
<dd class="ddef">
<div class="summary">Decompress and return any remaining data.
 The returned data should be appended to that returned by uncompress().
 The UnCompress object cannot be used further.</div></dd></dd>)
<dt class="decl"><a class="symbol _unittest" name="unittest:4" href="./htmlsrc/std.zlib.html#L543" kind="unittest" beg="543" end="595">unittest</a>; <a title="Permalink to this symbol" href="#unittest:4" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L543">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:5" href="./htmlsrc/std.zlib.html#L598" kind="unittest" beg="598" end="613">unittest</a>; <a title="Permalink to this symbol" href="#unittest:5" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L598">#</a></dt>
<dd class="ddef"></dd>)
</div>
<div id="footer">
  <p>Copyright © 1999-2008 by Digital Mars ®, All Rights Reserved.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Dec 28 04:26:49 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>